package main

/**
循环时钟

time.NewTicker	C <-chan Time	r runtimeTimer
SendTime StartTimer recerelease	addtimer

时间格式化

*/

import (
	"fmt"
	"time"
)

func main() {
	count := 0
	ticker := time.NewTicker(time.Second * 1)

	// 匿函数 调用 协程
	go func() {
		for {
			t := <-ticker.C
			fmt.Println("时间：", t.Format("2006-01-02 03:04:05PM"))
			count++
			if count > 2 {
				// return
				ticker.Stop()
			}
		}
	}()
	time.Sleep(time.Second * 4)
	fmt.Println("游戏结束")
}
